<template>
  <div class="bg-[#F9F9FA] scroll-smooth">
    <LazyNewsHeader />
    <main class="bg-[#fff] min-h-[60vh]">
      <nuxt class="" />
    </main>
    <footer class="mt-auto">
      <LazyCustomBottom />
    </footer>
    <!-- 回到顶部按钮组件 -->
    <!-- <LazyBackToTop /> -->
  </div>
</template>
<script>
  export default {
    name: 'NewsPageLayout',
    data() {
      return {
        newsData: {}, // 存储新闻数据的对象
        loading: false // 加载状态标志
      }
    },
    created() {
      this.initializeData()
    },
    methods: {
      // 获取新闻列表数据
      async initializeData() {
        const initActions = [
          // ["initData/getInitData", "初始化基础数据"],
          //  ["initData/getInitData2", "获取多语言数据"],
          //  ["initData/getCategoryData", "获取分类数据"],
          // ["user/getUserInfo", "获取用户数据"],
          ['initData/getFooterData', '获取页脚数据'],
          ['user/getNewsList', '获取新闻数据']
        ]
        try {
          await Promise.all(initActions.map(([action]) => this.$store.dispatch(action)))
          this.$nuxt.$loading.finish()
        } catch (error) {
          console.error('数据初始化失败:', error)
        }
      }
    }
  }
</script>
<style lang="less" scoped></style>
